/**
 *
 */
 import React from 'react';
import {
    View,
    Text,
    StyleSheet,
    Platform,
    WebView,
} from 'react-native';
import BaseStyle from './styles/baseStyle';
import Tools from './tools/tool';
import Icon from "./components/react-native-iconfont/IconFont.js"

import {Header,Container,Left,Right,Body,Button,Title} from "native-base";
export default class productsIndex extends React.Component {
    constructor(props) {
        super(props);
        let {getParam}=this.props.navigation
        this.data=getParam("item")
        this.state = {        
            title:this.data.title,
            webUrl:this.data.url
        }
    }

    componentDidMount() {
    }
    goback() {
        let {navigator,route,param} = this.props;
        if (!this.canGoBack) {
            navigator&&navigator.pop();
            return;
          };
        this.refs.webviewbridge&&this.refs.webviewbridge.goBack(); 
    }

    render() {
       // let WebComponent=Platform.OS=="ios"?WebView:WebViewBridge
        return(
            <Container>
                <Header>
                    <Left>
                        <Button transparent onPress={()=>this.props.navigation.goBack()}>
                          <Icon name='return' size={18} color="#333"/>
                        </Button>
                    </Left>
                    <Body>
                        <Title>Header</Title>
                    </Body>
                    <Right/>

                </Header>
                <WebView
                    style={[styles.webview]}
                    ref="webviewbridge"
                    source={{uri: this.state.webUrl}}
                    domStorageEnabled={true}
                    startInLoadingState={true}
                    javaScriptEnabled={true}/>
            </Container>)    
    }
};

var styles = StyleSheet.create({
   

});

